package com.ruoyi.quartz.task;

import cn.hutool.core.convert.Convert;
import com.fasterxml.jackson.databind.JsonNode;
import com.ruoyi.quartz.domain.SysJobLog;
import com.ruoyi.quartz.service.ISysJobLogService;
import com.ruoyi.swla2.service.ITerminalsService;
import com.ruoyi.swla2.service.ITerminalsXbService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 定时任务调度测试
 * 
 * @author ruoyi
 */
@Slf4j
@Component("ryTask")
public class RyTask
{

    @Autowired
    private ITerminalsService terminalsService;

    @Autowired
    private ITerminalsXbService terminalsXbService;

    @Autowired
    private ISysJobLogService jobLogService;

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }


    /**
    * @Description: 同步大表数据（档案，实时数据，历史数据）
    * @date: 2025/4/15 11:16
    * @author: zt
    */
    public void syncDb(){
        Date maxTime = jobLogService.selectMaxTimeForTask("ryTask.syncDb()");
        terminalsService.syncDb(maxTime);
    }

    /**
     * @Description: 同步大表数据（档案，实时数据，历史数据）
     * @date: 2025/4/15 11:16
     * @author: zt
     */
    public void syncXb(){
        Date maxTime = jobLogService.selectMaxTimeForTask("ryTask.syncXb()");
        terminalsXbService.syncXb(maxTime);
    }
}
